package com.example.video

import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.alibaba.android.arouter.launcher.ARouter
import com.example.base.app.RouterPath
import com.example.common.base.BaseActivity
import com.example.common.view.CircleCountDownView
import com.example.image.glide.GlideImgLoader
import com.example.ndk.NativeLib
import com.example.video.databinding.ActivityAppBinding
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class AppActivity : BaseActivity<ActivityAppBinding>() {
    override fun getLayoutId(): Int =R.layout.activity_app

    override fun initViews() {
        //加载App主图
        mDataBinding.ivApp.run {
            GlideImgLoader.loadResImage(this,R.drawable.ic_start_app,this)
        }
        mDataBinding.cdView.startCountDown()
        mDataBinding.cdView.apply {
            setCountDownListener(object :CircleCountDownView.CountDownListener{
                override fun onCountDownFinish() {
                    ARouter.getInstance().build(RouterPath.PATH_MAIN_ACTIVITY).navigation()
                    finish()
                    mDataBinding.cdView.stopCountDown()
                }
            })
        }
        mDataBinding.cdView.setOnClickListener {
            ARouter.getInstance().build(RouterPath.PATH_MAIN_ACTIVITY).navigation()
            finish()
            mDataBinding.cdView.stopCountDown()
        }
    }

    override fun onDestroy() {
        super.onDestroy()
        mDataBinding.cdView.stopCountDown()
    }

}